package scene;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

import scene.manager.IScene;
import scene.manager.SceneMediator;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import device.graphics.GraphicsDevice;
import device.input.InputDevice;



public class Texture extends IScene
{



	public Texture( SceneMediator mediator )
	{
		super( mediator );
	}

	/**
	 *
	 */
	@Override
	public void initialize()
	{


	}

	   //float配列をFloatBufferに変換
    private FloatBuffer makeFloatBuffer(float[] array) {
        FloatBuffer fb=ByteBuffer.allocateDirect(array.length*4).order(
            ByteOrder.nativeOrder()).asFloatBuffer();
        fb.put(array).position(0);
        return fb;
    }

    private ShortBuffer makeShortBuffer(short[] array) {
    	ShortBuffer sb=ByteBuffer.allocateDirect(array.length*2).order(
            ByteOrder.nativeOrder()).asShortBuffer();
        sb.put(array).position(0);
        return sb;
    }

    private ByteBuffer makeByteBuffer(int size) {
    	ByteBuffer sb=ByteBuffer.allocateDirect(size).order(
            ByteOrder.nativeOrder());

        return sb;
    }

	/**
	 *
	 * @param inputDevice
	 */
	@Override
	public void update(InputDevice inputDevice)
	{
	}

	private boolean flag = true;
	/**
	 *
	 * @param graphicsDevice
	 */
	@Override
	public void draw(GraphicsDevice graphicsDevice)
	{


	}

	/**
	 *
	 */
	@Override
	public void finish()
	{
		// TODO 自動生成されたメソッド・スタブ

	}

	 //ビットマップのリサイズ
    private Bitmap resizeBitmap(Bitmap bmp,int w,int h) {
        Bitmap result=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_8888);
        Canvas canvas=new Canvas(result);
        BitmapDrawable drawable=new BitmapDrawable(bmp);
        drawable.setBounds(0,0,bmp.getWidth(),bmp.getHeight());
        drawable.draw(canvas);
        return result;
    }
}